
#include <mem.h>

/* ------------------------------------------------------------------------- */

static uint8 mcpx_buf[MCPX_SIZE];

/* ------------------------------------------------------------------------- */

void fastcall mcpx_init(const void *image)
{
	memcpy(mcpx_buf, image, MCPX_SIZE);
}

uint32 fastcall mcpx_read(uint32 addr)
{
	uint32 data;

	if (addr >= MCPX_SIZE)
		return 0xffffffff;

	if (addr <= MCPX_SIZE - 4)
		return *(uint32 *)(&mcpx_buf[addr]);

	data = 0xffffffff;
	memcpy(&data, &mcpx_buf[addr], MCPX_SIZE - addr);
	return data;
}

/* ------------------------------------------------------------------------- */
